Skip to content

fix(miner): give manage-status and manage-poll store openers their own try/catch - #10206

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-10003
Jul 31, 2026
Merged

fix(miner): give manage-status and manage-poll store openers their own try/catch#10206
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-10003

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

fix(miner): give manage-status and manage-poll store openers their own try/catch

runManageStatus and runManagePoll opened their SQLite stores before any
try/finally, so an opener throw became an unhandled exception (exit 1
instead of the documented 2) and leaked any sibling store already opened.
Mirror runDiscover's pattern: each opener gets its own try/catch that
returns a clean CLI failure and closes whichever owned handles were
already opened.

Closes #10003

…n try/catch

runManageStatus and runManagePoll opened their SQLite stores before any
try/finally, so an opener throw became an unhandled exception (exit 1
instead of the documented 2) and leaked any sibling store already opened.
Mirror runDiscover's pattern: each opener gets its own try/catch that
returns a clean CLI failure and closes whichever owned handles were
already opened.
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 31, 2026 12:34
@loopover-orb

loopover-orb Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-31 12:52:45 UTC

4 files · 1 AI reviewer · no blockers · readiness 93/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR fixes a real bug: runManageStatus and runManagePoll previously opened their SQLite stores before any try/catch, so an opener throw propagated as an unhandled exception (exit 1) instead of the documented CLI failure code 2, and any sibling store already opened would leak. The fix wraps each opener in its own try/catch, mirroring runDiscover's pattern, closing only owned handles on failure. The test coverage is thorough, exercising each opener-throw branch, verifying owned-vs-injected close behavior, and using real (non-mocked) store opens in the regression tests to prove the actual close path fires.

Nits — 4 non-blocking
  • packages/loopover-miner/lib/manage-status.ts: the three sequential try/catch blocks for portfolioQueue/eventLedger/runStateStore push nesting depth in runManageStatus fairly deep (flagged at depth 5); consider a small helper that tracks opened stores in an array and closes them in reverse on catch to flatten this if a fourth store is ever added.
  • The duplicated `// Each opener gets its OWN try/catch...` comment block is copy-pasted near-verbatim in both files; consider extracting the rationale into one shared doc reference (e.g. discover-cli.ts) to avoid drift if the pattern changes.
  • Consider a small `openOwned(fn, owned)` helper in a shared module to DRY the repeated try/catch-and-close-siblings pattern across manage-status.ts, manage-poll.ts, and discover-cli.ts.
  • The nesting-depth flag on manage-status.ts:301 is minor but could be addressed by extracting the sequential opener block into a private function that returns the three stores or throws with cleanup already done.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #10003
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ⚠️ 20/25 Preflight is ready, but the PR body does not name the validation run.
Contributor workload ✅ 10/10 Author activity: 130 registered-repo PR(s), 92 merged, 3 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 130 PR(s), 3 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff wraps each store opener in manage-status.ts and manage-poll.ts in its own try/catch mirroring runDiscover, returning 2 via reportCliFailure and closing only owned handles already opened, exactly matching the issue's requirements and required pattern.

Review context
  • Author: bitfathers94
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 130 PR(s), 3 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add validation command/output.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

1 similar comment
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 31, 2026
@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.52%. Comparing base (780fe56) to head (cf0dae9).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10206      +/-   ##
==========================================
+ Coverage   80.44%   80.52%   +0.07%     
==========================================
  Files         282      284       +2     
  Lines       58764    58988     +224     
  Branches     6965     7052      +87     
==========================================
+ Hits        47274    47498     +224     
  Misses      11199    11199              
  Partials      291      291              
Flag Coverage Δ
backend 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/loopover-miner/lib/manage-poll.ts 100.00% <100.00%> (ø)
packages/loopover-miner/lib/manage-status.ts 100.00% <100.00%> (ø)

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 800045f into JSONbored:main Jul 31, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

miner(manage): a local-store open failure escapes runManageStatus/runManagePoll as an unhandled throw and leaks the sibling handle

1 participant